sharing code between lambda functions